package com.zxj.test.model.dto;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

import com.zxj.test.common.validation.Groups;

import org.hibernate.validator.constraints.Range;

/**
 * @author zxj
 * @date 2020/7/18
 */
public class EmployeeDTO {

    @Null(message = "新增员工不需要指定id", groups = Groups.Add.class)
    @Min(value = 1, message = "员工id不能小于{value}", groups = Groups.Update.class)
    @NotNull(message = "员工id不能为空", groups = Groups.Update.class)
    private Integer id;

    @Range(min = 12, max = 60, message = "年龄必须在{min}-{max}之间")
    private Integer age;

    @NotBlank(message = "员工姓名不能为空")
    private String name;

    private String address;

    @Pattern(regexp = "^male$|^female$",message = "员工性别字段错误，只能为male或female")
    private String gender;

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
